package com.tm.fiverole.mapper;

import com.tm.fiverole.entity.MenuEntity;
import com.tm.fiverole.entity.RoleMenuEntity;
import com.tm.fiverole.result.Result;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author wangSang
 * @create 2022-08-18 19:39
 */
@Mapper
public interface MenuMapper {
    List<MenuEntity>   queryMenu(@Param("list") List<Long> collect);


    List<MenuEntity> queryMenuAll();

    void addMenu(MenuEntity menuEntity);


    List<MenuEntity> queryIdMenu(@Param("id") Integer id);

    void deleteMapper(Integer id);

    @Select("SELECT DISTINCT msm.`name` from (mall_sys_user_role_relation msurr LEFT JOIN  mall_sys_role_menu_relation msrmr " +
            "on msurr.role_id = msrmr.role_id) LEFT JOIN  mall_sys_menu msm " +
            "on msrmr.menu_id = msm.id where msurr.user_id=#{id} ")
    List<String> querySysMenuListByUserId(@Param("id") Long id);
}
